<?php
$root = $_SERVER['DOCUMENT_ROOT'];
include($root . "/util/session.php"); //checks that the user is logged in
include($root . "/util/privilege_check.php");
checkPrivilege("teacher");
include($root . "/teacher/auxilary/usefulFunctions.php");
?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="Teacher panel">
  <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap" rel="stylesheet">
  <link rel="stylesheet" type="text/css" href="css/teacherStyle.css">
  <link rel="stylesheet" type="text/css" href="css/question.css">
  <title>Teacher main page</title>
</head>

<body>
  <?php
  include($root . "/teacher/pageParts/header.php");  if (isset($_SESSION['type'])) {
    if ($_SESSION['type'] == 'TF') {
      include($root . "/teacher/pageParts/question_true_false_form.php");
    } else {
      include($root . "/teacher/pageParts/question_multiple_form.php");
    }
  } else if (isset($_SESSION['questionUpdDel'])) {
    include($root . "/teacher/pageParts/questionDeleteUpdateForm.php");
  } else if (isset($_SESSION['questionAdd'])) {
    if (!isset($_POST['questionTypeMultiple'])) {
      include($root . "/teacher/pageParts/question_true_false_form.php");
    } else {
      include($root . "/teacher/pageParts/question_multiple_form.php");
    }
  } else if (isset($_POST['chapterPanel']) || isset($_SESSION['chapterPanel'])) {
    setChapters();
    include($root . "/teacher/pageParts/chapterPage.php");
  } else if (isset($_POST['subjectPanel']) || isset($_SESSION['subjectPanel'])) {
    setSubjects();
    include($root . "/teacher/pageParts/subjectPage.php");
  } else {
    include($root . "/teacher/pageParts/mainPage.php");
  }

  include($root . "/teacher/pageParts/footer.php");
  ?>
</body>
